home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / cd-sup / hippoplayer / support / terminatehip.s < prev    next >
Text File  |  1999-01-01  |  2KB  |  94 lines

  1. *************************
  2. * Terminate HippoPlayer *
  3. *************************
  4. * If HippoPlayer's port exists, send there a message telling HiP to terminate.
  5. * Can be assembled with Asm-One and Devpac.
  6. * v1.1 - Is pure and can be run from WB
  7.  
  8.  
  9.      incdir    include:
  10.     include    exec/exec_lib.i
  11.     include    exec/ports.i
  12.     include    libraries/dosextens.i
  13.  
  14.  
  15.     rsreset
  16. hport        rs.b    MP_SIZE
  17. hmessage    rs.b    MN_SIZE
  18. hkill        rs.l    1
  19. hsizeof        rs.b    0
  20.  
  21.     moveq    #hsizeof/2-1,d0
  22. cl    clr    -(sp)
  23.     dbf    d0,cl
  24.     move.l    sp,a5
  25.  
  26.     move.l    #"KILL",hkill(a5)    * Killer-message
  27.  
  28.     move.l    4.w,a6
  29.     sub.l    a1,a1
  30.     jsr    _LVOFindTask(a6)
  31.     move.l    d0,a4
  32.  
  33.     moveq    #0,d5
  34.     tst.l    pr_CLI(a4)
  35.     bne.b    hcli
  36.     lea    pr_MsgPort(a4),a0
  37.     jsr    _LVOWaitPort(a6)
  38.     lea    pr_MsgPort(a4),a0
  39.     jsr    _LVOGetMsg(a5)
  40.     move.l    d0,d5
  41. hcli
  42.     jsr    _LVOForbid(a6)
  43.     lea    hportname(pc),a1
  44.     jsr    _LVOFindPort(a6)
  45.     move.l    d0,d2
  46.  
  47.     tst.l    d2
  48.     beq.b    hnomsg0
  49.     move.l    d2,a3
  50.  
  51.     bsr.b    hcreateport
  52.  
  53.     lea    hmessage(a5),a1
  54.     NEWLIST    a1
  55.     move.l    a3,a0        
  56.     pea    hport(a5)
  57.     move.l    (sp)+,MN_REPLYPORT(a1)
  58.     jsr    _LVOPutMsg(a6)
  59.     jsr    _LVOPermit(a6)
  60.  
  61.     lea    hport(a5),a0    
  62.     jsr    _LVOWaitPort(a6)    * Returns when HiP is terminated.
  63.  
  64.     bsr.b    hdeleteport
  65.  
  66. hnomsg0    tst.l    d5
  67.     beq.b    hnomsg
  68.     jsr    _LVOForbid(a6)
  69.     move.l    d5,a1
  70.     jsr    _LVOReplyMsg(a5)
  71. hnomsg
  72.     lea    hsizeof(sp),sp
  73.     moveq    #0,d0
  74.     rts
  75.  
  76. hcreateport    lea    hport(a5),a2
  77.         moveq    #-1,d0
  78.         jsr    _LVOAllocSignal(a6)
  79.         move.b    d0,MP_SIGBIT(a2)
  80.         move.l    a4,MP_SIGTASK(a2)
  81.         move.b    #NT_MSGPORT,LN_TYPE(a2)
  82.         clr.b    MP_FLAGS(a2)
  83.         move.l    a2,a1
  84.         jmp    _LVOAddPort(a6)
  85.  
  86. hdeleteport    lea    hport(a5),a2
  87.         move.l    a2,a1
  88.         jsr    _LVORemPort(a6)
  89.         moveq    #0,d0
  90.         move.b    MP_SIGBIT(a2),d0
  91.         jmp    _LVOFreeSignal(a6)
  92.  
  93. hportname    dc.b    "HiP-Port",0
  94.